package com.terabits.smartriver.constants;

/**
 * Created by Yin on 2019/3/13
 */
public enum MongoDBEnum {
    //GridFS存储筒

    /**
     * 项目资料
     */
    PROJECT_MATERIAL(1, "project_material"),
    /**
     * 盒子资料
     */
    BOX_MATERIAL(3, "box_material"),
    /**
     * 保养照片
     */
    DEVICE_MAINTENANCE(2, "device_maintenance"),

    /**
     * 测试用吧
     */
    test_all(0, "all"),
    /**
     * 测试用吧
     */
    test_img(-1, "img"),
    /**
     * 测试用吧
     */
    test_pdf(-2, "pdf"),
    /**
     * 测试用吧
     */
    test_word(-3, "word");


    private Integer type;

    private String gridFSBucket;

    MongoDBEnum(Integer type, String gridFSBucket) {
        this.type = type;
        this.gridFSBucket = gridFSBucket;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getGridFSBucket() {
        return gridFSBucket;
    }

    public void setGridFSBucket(String gridFSBucket) {
        this.gridFSBucket = gridFSBucket;
    }

    public static String getGridFSBucket(Integer type) {
        switch (type) {
            case -1:
                return MongoDBEnum.test_img.getGridFSBucket();
            case -2:
                return MongoDBEnum.test_pdf.getGridFSBucket();
            case -3:
                return MongoDBEnum.test_word.getGridFSBucket();
            case 0:
                return MongoDBEnum.test_all.getGridFSBucket();
            case 1:
                return MongoDBEnum.PROJECT_MATERIAL.getGridFSBucket();
            case 2:
                return MongoDBEnum.DEVICE_MAINTENANCE.getGridFSBucket();
            case 3:
                return MongoDBEnum.BOX_MATERIAL.getGridFSBucket();
            default:
                return null;
        }
    }
}
